package com.chixing.ih.module.admin.mapper;

import com.chixing.ih.module.admin.mapper.Provider.AdminTaskMapperProvider;
import com.chixing.ih.module.task.pojo.Task;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface AdminTaskMapper {

    @SelectProvider(type = AdminTaskMapperProvider.class, method = "getPendingTasks")
    @Results(id = "taskMap", value = {
            @Result(id = true, column = "id", property = "id"),
            @Result(column = "user_id", property = "isSuerId"),
            @Result(column = "task_title", property = "mandateTitle"),
            @Result(column = "talent_categories", property = "talentCategory"),
            @Result(column = "requirement_description", property = "requirementsDescription"),
            @Result(column = "technology", property = "skillsRequirements"),
            @Result(column = "work_way", property = "operationMode"),
            @Result(column = "salary", property = "salary"),
            @Result(column = "work_cycle", property = "workCycle"),
            @Result(column = "work_place", property = "workPlace"),
            @Result(column = "publishing_name", property = "isSuerName"),
            @Result(column = "publishing_phone", property = "isSuerTelephone"),
            @Result(column = "task_status", property = "taskStatus"),
            @Result(column = "type_status", property = "releaseStatus"),
            @Result(column = "is_deleted", property = "logicalDeletion"),
            @Result(column = "create_time", property = "createTime"),
            @Result(column = "update_time", property = "updateTime"),
            @Result(column = "is_sign", property = "marked"),
            @Result(column = "is_refresh", property = "refreshing")
    })
    List<Task> getPendingTasks(String keyword);

    @SelectProvider(type = AdminTaskMapperProvider.class, method = "getAuditedTasks")
    @ResultMap("taskMap")
    List<Task> getAuditedTasks(String keyword);

    @SelectProvider(type = AdminTaskMapperProvider.class, method = "getRefusedTasks")
    @ResultMap("taskMap")
    List<Task> getRefusedTasks(String keyword);

    @UpdateProvider(type = AdminTaskMapperProvider.class, method = "applicationApproved")
    boolean applicationApproved(Integer id);

    @UpdateProvider(type = AdminTaskMapperProvider.class, method = "rejectApplication")
    boolean rejectApplication(Integer id);

    @UpdateProvider(type = AdminTaskMapperProvider.class, method = "resetApplication")
    boolean resetApplication(Integer id);


}
